# -*- coding: utf-8 -*-
from __future__ import print_function
import yaml
import os

def update_yaml_attr(yaml_fn, attr, value):
    with open(yaml_fn, 'r') as f:
        config = yaml.load(f, Loader=yaml.FullLoader)
        config[attr] = value
    with open(yaml_fn, 'w') as f:
        f.write(yaml.dump(config))


def test_update_yaml_id():
    yaml_fn = '../../examples/cifar10_resnet20/job_0.yaml'
    jid = 'sssssss'
    update_yaml_attr(yaml_fn, 'id', jid)


if __name__ == '__main__':
    test_update_yaml_id()
